<!DOCTYPE html>
<html lang="en">
{% load filter %}
<head>
    <meta charset="UTF-8">
    <title>模板过滤器</title>
    <style>
        .red{
            background-color: red;

        }
        .yellow{
            background-color: yellow;
        }
        .block{
            background-color: black;
        }

    </style>
</head>
<body>
<ul>
   {% for name in username%}
       {#% if name.id|mod %#}
       {% if name.id|mod_val:3 %}
       <li class="red">{{ forloop.counter}}--{{name.usename}}--{{name.create_time|date:'Y年-m月-d日'}}</li>
       {% else %}
       <li class="yellow">{{ forloop.counter}}--{{name.usename}}--{{name.create_time|date:'Y年-m月-d日'}}</li>
       {% endif %}
   {% endfor%}
</ul>
default过滤器:<br/>
{{ content|default:'hello' }}
</body>
</html>